package com.ft.turorial.spring.boot.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import org.springframework.format.annotation.DateTimeFormat;

@Entity
@Table(name="user")
public class User implements Serializable{
	
	private static final long serialVersionUID = -8971505764090290428L;
	private Integer id;
    private String name;
	private Date birthday;
    
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }
    
    @Column(name="name")
    public String getName() {
        return name;
    }

    @Column(name="birthday")
	@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    public Date getBirthday() {
		return birthday;
	}

	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}

	public void setName(String name) {
        this.name = name == null ? null : name.trim();
    }
}
